home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / X11 / Xaw / TextSink.h < prev    next >
C/C++ Source or Header  |  2006-04-12  |  8KB  |  365 lines

  1. /*
  2.  * $Xorg: TextSink.h,v 1.4 2001/02/09 02:03:46 xorgcvs Exp $
  3.  */
  4.  
  5. /***********************************************************
  6.  
  7. Copyright 1987, 1988, 1994, 1998  The Open Group
  8.  
  9. Permission to use, copy, modify, distribute, and sell this software and its
  10. documentation for any purpose is hereby granted without fee, provided that
  11. the above copyright notice appear in all copies and that both that
  12. copyright notice and this permission notice appear in supporting
  13. documentation.
  14.  
  15. The above copyright notice and this permission notice shall be included in
  16. all copies or substantial portions of the Software.
  17.  
  18. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  19. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  20. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
  21. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  22. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  23. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24.  
  25. Except as contained in this notice, the name of The Open Group shall not be
  26. used in advertising or otherwise to promote the sale, use or other dealings
  27. in this Software without prior written authorization from The Open Group.
  28.  
  29.  
  30. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
  31.  
  32.                         All Rights Reserved
  33.  
  34. Permission to use, copy, modify, and distribute this software and its 
  35. documentation for any purpose and without fee is hereby granted, 
  36. provided that the above copyright notice appear in all copies and that
  37. both that copyright notice and this permission notice appear in 
  38. supporting documentation, and that the name of Digital not be
  39. used in advertising or publicity pertaining to distribution of the
  40. software without specific, written prior permission.  
  41.  
  42. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  43. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  44. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  45. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  46. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  47. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  48. SOFTWARE.
  49.  
  50. ******************************************************************/
  51. /* $XFree86: xc/lib/Xaw/TextSink.h,v 1.9 2001/01/17 19:42:35 dawes Exp $ */
  52.  
  53. #ifndef _XawTextSink_h
  54. #define _XawTextSink_h
  55.  
  56. #include <X11/Xaw/Text.h>
  57.  
  58. /***********************************************************************
  59.  *
  60.  * TextSink Object
  61.  *
  62.  ***********************************************************************/
  63.  
  64. /* Resources:
  65.  
  66.  Name             Class        RepType        Default Value
  67.  ----             -----        -------        -------------
  68.  font                Font            XFontStruct *      XtDefaultFont
  69.  foreground          Foreground      Pixel              XtDefaultForeground
  70.  background          Background      Pixel              XtDefaultBackground
  71.  cursorColor         Color          Pixel        XtDefaultForeground
  72. */
  73.  
  74. /* Class record constants */
  75.  
  76. extern WidgetClass textSinkObjectClass;
  77.  
  78. typedef struct _TextSinkClassRec *TextSinkObjectClass;
  79. typedef struct _TextSinkRec      *TextSinkObject;
  80.  
  81. typedef enum {XawisOn, XawisOff} XawTextInsertState;
  82.  
  83. #ifndef OLDXAW
  84. #ifndef XtNcursorColor
  85. #define XtNcursorColor        "cursorColor"
  86. #endif
  87.  
  88. #define XawNtextProperties    "textProperties"
  89. #define XawCTextProperties    "TextProperties"
  90. #define XawRTextProperties    "XawTextProperties"
  91. #endif
  92.  
  93. /*
  94.  * Public Functions
  95.  */
  96. _XFUNCPROTOBEGIN
  97.  
  98. /*
  99.  * Function:
  100.  *    XawTextSinkDisplayText
  101.  *
  102.  * Parameters:
  103.  *    w      - the TextSink Object
  104.  *    x      - location to start drawing text
  105.  *    y      - ""
  106.  *    pos1      - location of starting and ending points in the text buffer
  107.  *    pos2      - ""
  108.  *    highlight - hightlight this text?
  109.  *
  110.  * Description:
  111.  *    Stub function that in subclasses will display text. 
  112.  *
  113.  * Note:
  114.  *      This function doesn't actually display anything, it is only a place
  115.  *    holder.
  116.  */
  117. void XawTextSinkDisplayText
  118. (
  119.  Widget            w,
  120. #if NeedWidePrototypes
  121.  int            x,
  122.  int            y,
  123. #else
  124.  Position        x,
  125.  Position        y,
  126. #endif
  127.  XawTextPosition    pos1,
  128.  XawTextPosition    pos2,
  129. #if NeedWidePrototypes
  130.  int            highlight
  131. #else
  132.  Boolean        highlight
  133. #endif
  134.  );
  135.  
  136. /*
  137.  * Function:
  138.  *    XawTextSinkInsertCursor
  139.  *
  140.  * Parameters:
  141.  *    w    - the TextSink Object.
  142.  *    x    - location for the cursor.
  143.  *    y    - ""
  144.  *    state    - whether to turn the cursor on, or off
  145.  *
  146.  * Description:
  147.  *    Places the InsertCursor.
  148.  *
  149.  * Note:
  150.  *      This function doesn't actually display anything, it is only a place
  151.  *    holder.
  152.  */
  153. void XawTextSinkInsertCursor
  154. (
  155.  Widget            w,
  156. #if NeedWidePrototypes
  157.  int            x,
  158.  int            y,
  159.  int            state
  160. #else
  161.  Position        x,
  162.  Position        y,
  163.  XawTextInsertState    state
  164. #endif
  165.  );
  166.  
  167. /*
  168.  * Function:
  169.  *    XawTextSinkClearToBackground
  170.  *
  171.  * Parameters:
  172.  *    w    - TextSink Object
  173.  *    x    - location of area to clear
  174.  *    y    - ""
  175.  *    width    - size of area to clear
  176.  *    height    - ""
  177.  *
  178.  * Description:
  179.  *    Clears a region of the sink to the background color.
  180.  *
  181.  * Note:
  182.  *      This function doesn't actually display anything, it is only a place
  183.  *    holder.
  184.  */
  185. void XawTextSinkClearToBackground
  186. (
  187.  Widget            w,
  188. #if NeedWidePrototypes
  189.  int            x,
  190.  int            y,
  191.  unsigned int        width,
  192.  unsigned int        height
  193. #else
  194.  Position        x,
  195.  Position        y,
  196.  Dimension        width,
  197.  Dimension        height
  198. #endif
  199.  );
  200.  
  201. /*
  202.  * Function:
  203.  *    XawTextSinkFindPosition
  204.  *
  205.  * Parameters:
  206.  *    w        - TextSink Object
  207.  *    fromPos        - reference position
  208.  *    fromX        - reference location
  209.  *    width        - width of section to paint text
  210.  *    stopAtWordBreak - returned position is a word break?
  211.  *    resPos        - Position to return
  212.  *    resWidth    - Width actually used
  213.  *    resHeight    - Height actually used
  214.  *
  215.  * Description:
  216.  *    Finds a position in the text.
  217.  */
  218. void XawTextSinkFindPosition
  219. (
  220.  Widget            w,
  221.  XawTextPosition    fromPos,
  222.  int            fromX,
  223.  int            width,
  224. #if NeedWidePrototypes
  225.  int            stopAtWordBreak,
  226. #else
  227.  Boolean        stopAtWordBreak,
  228. #endif
  229.  XawTextPosition*    pos_return,
  230.  int            *width_return,
  231.  int            *height_return
  232.  );
  233.  
  234. /*
  235.  * Function:
  236.  *    XawTextSinkFindDistance
  237.  *
  238.  * Parameters:
  239.  *    w        - TextSink Object
  240.  *    fromPos        - starting Position
  241.  *    fromX        - x location of starting Position
  242.  *    toPos        - end Position
  243.  *    resWidth    - Distance between fromPos and toPos
  244.  *    resPos        - Acutal toPos used
  245.  *    resHeight    - Height required by this text
  246.  *
  247.  * Description:
  248.  *    Find the Pixel Distance between two text Positions.
  249.  */
  250. void XawTextSinkFindDistance
  251. (
  252.  Widget            w,
  253.  XawTextPosition    fromPos,
  254.  int            fromX,
  255.  XawTextPosition    toPos,
  256.  int            *width_return,
  257.  XawTextPosition    *pos_return,
  258.  int            *height_return
  259.  );
  260.  
  261. /*
  262.  * Function:
  263.  *    XawTextSinkResolve
  264.  *
  265.  * Parameters:
  266.  *    w    - TextSink Object
  267.  *    pos    - reference Position
  268.  *    fromx    - reference Location
  269.  *    width    - width to move
  270.  *    resPos    - resulting position
  271.  *
  272.  * Description:
  273.  *    Resloves a location to a position.
  274.  */
  275. void XawTextSinkResolve
  276. (
  277.  Widget            w,
  278.  XawTextPosition    fromPos,
  279.  int            fromX,
  280.  int            width,
  281.  XawTextPosition    *pos_return
  282.  );
  283.  
  284. /*
  285.  * Function:
  286.  *    XawTextSinkMaxLines
  287.  *
  288.  * Parameters:
  289.  *    w    - TextSink Object
  290.  *    height    - height to fit lines into
  291.  *
  292.  * Returns:
  293.  *    Number of lines that will fit
  294.  *
  295.  * Description:
  296.  *    Finds the Maximum number of lines that will fit in a given height.
  297.  */
  298. int XawTextSinkMaxLines
  299. (
  300.  Widget            w,
  301. #if NeedWidePrototypes
  302.  unsigned int        height
  303. #else
  304.  Dimension        height
  305. #endif
  306.  );
  307.  
  308. /*
  309.  * Function:
  310.  *    XawTextSinkMaxHeight
  311.  *
  312.  * Parameters:
  313.  *    w    - TextSink Object
  314.  *    lines    - number of lines
  315.  *
  316.  * Returns:
  317.  *    Height
  318.  *
  319.  * Description:
  320.  *    Finds the Minium height that will contain a given number lines.
  321.  */
  322. int XawTextSinkMaxHeight
  323. (
  324.  Widget            w,
  325.  int            lines
  326. );
  327.  
  328. /*
  329.  * Function:
  330.  *    XawTextSinkSetTabs
  331.  *
  332.  * Parameters:
  333.  *    w        - TextSink Object
  334.  *    tab_count    - number of tabs in the list
  335.  *    tabs        - text positions of the tabs
  336.  * Description:
  337.  *    Sets the Tab stops.
  338.  */
  339. void XawTextSinkSetTabs
  340. (
  341.  Widget            w,
  342.  int            tab_count,
  343.  int            *tabs
  344. );
  345.                           
  346. /*
  347.  * Function:
  348.  *    XawTextSinkGetCursorBounds
  349.  *
  350.  * Parameters:
  351.  *    w    - TextSink Object
  352.  *    rect    - X rectance containing the cursor bounds
  353.  * Description:
  354.  *    Finds the bounding box for the insert curor (caret).
  355.  */
  356. void XawTextSinkGetCursorBounds
  357. (
  358.  Widget            w,
  359.  XRectangle        *rect_return
  360. );
  361.  
  362. _XFUNCPROTOEND
  363.  
  364. #endif /* _XawTextSink_h */
  365.